﻿using Microsoft.Extensions.ObjectPool;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ObjectPoolDemo
{
    public class ConnectionPooledObjectPolicy : PooledObjectPolicy<Connection>
    {
        // 创建实例对象
        public override Connection Create()
        {
            return new Connection();
        }

        //将对象返回池中
        public override bool Return(Connection obj)
        {
            return true;
        }
    }
}
